<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../vue1/node_modules/vue/dist/vue.min.js"></script>
</head>

<body>
    <div id="app">
        <div>
            <div>苹果：7元&ensp;你要购买的数量是
                <input type="number" v-model="num1" />
            </div><br/>
            <div>桔子：5元&ensp;你要购买的数量是
                <input type="number" v-model="num2" />
            </div><br/>
            <div>香蕉：4元&ensp;你要购买的数量是
                <input type="number" v-model="num3" />
            </div><br/>
            <button @click="count">确定</button>
            <span>你的总价为：{{price}}</span>
        </div>

    </div>
    <script>
        var vm = new Vue({
            el: '#app',
            data: {
                price: 0,
                num1:0,
                num2:0,
                num3:0
            },
            methods:{
                count(){
                    this.price=this.num1*7+this.num2*5+this.num3*4
                }
            }
        })
    </script>
</body>

</html>
